#!/usr/bin/python

# This imports the mailing library to interface with Gmail's smtp server
import smtplib
# This is a module that lets your format emails correctly
from email.mime.text import MIMEText

# Get datetime support
from datetime import date,timedelta
tomorrow = date.today() + timedelta(days=1)

# Parse out the MOS values using this library
import sys
sys.path.append('/home/disk/pvort/lmadaus/nobackup/wxc_parsing')
from surface_parse_bufkit import mos_parser

# Grab the GFS mos values
GFS_mos,maxmin = mos_parser('phto','GFS')
# Find the total winds and precip
high = maxmin[date.today


# From address and to address are pretty self-explanatory
# So is the subject of the email
from_address = 'madaus.le@gmail.com'
# The to_address is a list of all addresses you want to send it to with
# email addresses separated by commas
to_address = ['lmadaus@atmos.washington.edu']
subject = 'Another test of automatic emails'

# This is where the email message goes.  A triple-quoted string
# means treat everything between the triple quotes as one big string.
# This lets you format the whole email here:
email_text = """

Test of email automation.

Hopefully this works.

"""

# Format the text as an email here using the MIMEText module
msg = MIMEText(email_text)
msg['Subject'] = subject
msg['From'] = from_address
msg['To'] = to_address


# User name and password for the Gmail account go here (it does need to know the password)
username = 'madaus.le'
password = ''



# Use smtplib to send the mail through Gmail's smtp server
#session = smtplib.SMTP('smtp.gmail.com',587)
#session.starttls()
#session.login(username,password)
#send_result = session.sendmail(from_address, to_address, msg.as_string())

# send_result should be empty if nothing went wrong.  Check for this.
#if send_result:
#    for recipient in send_result.keys():
#        print "Error -- mail not sent to:", recipient
#else:
#    print "All emails sent successfully."

# Exit the server
#session.quit()
